package kiv.janecekz;

import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

import android.view.View;
import android.widget.SeekBar;

import com.quietlycoding.android.picker.NumberPicker;

public class ObserversUpdater implements Observer {
	private ArrayList<View> views = new ArrayList<View>();
	
	public void addView(View v) {
		views.add(v);
	}
	
	@Override
	public void update(Observable observable, Object data) {
		for (View view : views) {
			if (view instanceof SeekBar) {
				((SeekBar) view).setProgress(((Tempomat) observable).getBPM()-Tempomat.MIN_BPM);
			}
			if (view instanceof NumberPicker) {
				((NumberPicker) view).setCurrent(((Tempomat) observable).getBPM());
			}
		}
	}

}
